@extends('backend::layout')
@section('content')
    <table class="table table-bordered table-striped tbody info-card">
        <tbody>
        <tr><td>未用数量</td><td>未用面值</td><td>未用市值</td>
            <td>已用数量</td><td>已用面值</td><td>已用市值</td>
        </tr>
        <tr>
            @foreach($count as $item)
                <td>{{$item->num ?? 0}}</td><td>{{$item->face_money ??0}}</td><td>{{$item->market_money??0}}</td>
            @endforeach
        </tr>
        </tbody>
    </table>
    @if(isset($search_tpl))
        {{$search_tpl->render()}}
    @endif
    @component('backend::component.table.table-content')
        @slot('page_title') 提货券统计 @endslot
        @slot('icon') hcl-sell-map @endslot
        @slot('class') mt-3 @endslot
        @slot('body_content')
            @if($list->isNotEmpty())
                <table class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>
                            @component('backend::component.checkbox')
                                @slot('name') ids-all @endslot
                            @endcomponent
                        </th>
                        <th>账号</th>
                        <th>未使用数量</th>
                        <th>已使用数量</th>
                        <th>未使用面值</th>
                        <th>已使用面值</th>
                        <th>未使用市值</th>
                        <th>已使用市值</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($list as $value)
                        <tr>
                            <td>
                                @component('backend::component.checkbox')
                                    @slot('name') id[] @endslot
                                    @slot('class') id @endslot
                                    @slot('value') {{$value->user_id}} @endslot
                                @endcomponent
                            </td>
                            <td>{{$value->user->user_number}}[{{$value->user->real_name}}][{{$value->user->user_phone}}]</td>
                            <td>{{$value->no_num}}</td>
                            <td>{{$value->has_num}}</td>
                            <td>{{$value->no_face_money}}</td>
                            <td>{{$value->has_face_money}}</td>
                            <td>{{$value->no_market_money}}</td>
                            <td>{{$value->has_market_money}}</td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                @slot('list_page')
                    {{$list->appends($search_tpl->getSearchData())->links('backend::public.pagination')}}
                @endslot
            @else
                @component('backend::public.empty_page')
                    @slot('info') 暂时没有记录 @endslot
                @endcomponent
            @endif
        @endslot
    @endcomponent

@endsection
@push('scripts')
    <script src="{{asset(config('view.plugin').'/chart/echart/echarts.min.js')}}"></script>
    <script>
        function rgChart() {
            $.get("{{route('b_PlatStats_chartTg')}}",function (response) {
                if(response.status){
                    var myChart = echarts.init(document.getElementById('rg-chart'));
                    option = {
                        tooltip: {
                            trigger: 'axis'
                        },
                        legend: {
                            data:['托管次数','回款次数']
                        },
                        xAxis: {
                            type: 'category',
                            data: response.data.dates
                        },
                        yAxis: {
                            type: 'value'
                        },
                        series: [{
                            name:'托管次数',
                            type: 'bar',
                            data: response.data.in_num
                        },{
                            name:'回款次数',
                            type: 'bar',
                            data: response.data.out_num
                        }]
                    };
                    myChart.setOption(option);
                }
            })
        }

    </script>
@endpush